/**
 * 消息ajax
 * @author 陈盼
 * date 2024-01-10 下午 07：06
 */
class Message {
    /**
     * 新增活动
     * @param message json实体类
     * @return {Promise<unknown>}
     */
    addMessage(message){
        return new Promise((resolve, reject) => {
            $.ajax({
                url: "/www.xiaomi.com/background/add/activity",
                method: "POST",
                data: {
                    message:JSON.stringify(message)
                },
                success: function (response) {
                    resolve(response);
                },
                error: function (error) {
                    reject(error);
                }
            });
        });
    }
    /**
     * 删除活动
     * @param messageId 消息Id
     * @return {Promise<unknown>}
     */
    deleteMessage(messageId){
        return new Promise((resolve, reject) => {
            $.ajax({
                url: "/www.xiaomi.com/background/delete/activity",
                method: "POST",
                data: {
                    messageId:messageId
                },
                success: function (response) {
                    resolve(response);
                },
                error: function (error) {
                    reject(error);
                }
            });
        });
    }
}